package a10_StreamIO;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;

/**
 * @Author quan
 * @Description TODO
 * @Date 2023/5/24 17:17
 */
public class a06_Scanner {
    public static void main(String[] args) throws IOException {
        //1、创建一个输出流
        FileInputStream inputStream = new FileInputStream("D:/hello.txt");
        //2、根据创建的输入流创Scanner对象
        Scanner scanner = new Scanner(inputStream,"UTF-8");
        //3、循环读取内容
        while (scanner.hasNextLine()){
            String next = scanner.nextLine();
            System.out.println(next);
        }
        //4、关闭scanner
        scanner.close();
        //5、关闭流
        inputStream.close();
    }
}
